extends MonsterAction


func get_next_action() -> int:
	return 1;

@export var damage := 4


func perform_action() -> void:
	if not monster or not target:
		return	
	var tween := create_tween()
	monster.play_animation("attack")
	Shake.shake(target, 16, 0.2)
	tween.tween_callback(
		func():
			Events.take_damage.emit(monster, target, Globals.get_final_damage(monster.state, Globals.player_state, self.damage))
	)
	tween.tween_interval(0.21)
	await tween.finished
	Events.monster_action_completed.emit(monster)
	monster.play_animation("default")
	

func init_intent_value():
	var intent_attack = ALL_INTENT_TRES_DICT.intent_dict[Intent.INTENT.ATTACK_S].duplicate()
	intent_attack.value = damage
	self.intent = intent_attack;
